﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using PresentationWpf.DB;

namespace PresentationWpf
{
    /// <summary>
    /// Interaction logic for SelectorFromDB.xaml
    /// </summary>
    public partial class SelectorFromDB : Window
    {
        Arbore.Arbore arb;
        public SelectorFromDB(ref Arbore.Arbore ab)
        {
            arb = ab;
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            var m = (Arbor)dataGrid1.SelectedItem;
            LoadeArbore l = new LoadeArbore();
            l.Loade(ref arb, m.Nume);
            this.Close();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            using (Database1Entities db = EntityConnectionManager.Instance.GetNewEntityConnection)
            {
                var m= db.Arbori.ToList();
                dataGrid1.ItemsSource = m;
            }
        }
    }
}
